import HttpClient from "@/utils/request.js";
import { PcListUserOrder, PcListUserDetail, ListDetailByOrderIdItem } from "@/interfaces/cct.js";
const http = new HttpClient({
    baseURL: 'https://new.uhx.io/cct', // 代理地址
    timeout: 50000,
});

export const listTradingOn = () => {
    return http.get('/coin/listTradingOn?unitName=USDT');
}

export const limitBuy = (params: {
    userId: string
    coinName: string
    unitName: string
    totalNum: string | number
    unitPrice: string | number
    turnover: string
}) => http.post('/order/limitBuy', { params })

export const limitSell = (params: {
    userId: string
    coinName: string
    unitName: string
    totalNum: string | number
    unitPrice: string | number
    turnover: string
}) => http.post('/order/limitSell', { params })

export const marketBuy = (params: {
    userId: string
    coinName: string
    unitName: string
    turnover: string | number
}) => http.post('/order/marketBuy', { params })


export const marketSell = (params: {
    userId: string
    coinName: string
    unitName: string
    turnover: string | number
}) => http.post('/order/marketSell', { params })

export const pcListUserOrder = (params: {
    coinName: string
    unitName: string
    pageNum: string | number
    pageSize: string | number
    type?: string
}) => http.get<PcListUserOrder>('/order/pcListUserOrder', { params })



export const cancel = (params: {
    orderId: string
}) => http.post('/order/cancel', { params, showMsg: true })



export const pcListUserDetail = (params: {
    coinName: string
    unitName: string
    pageNum: string | number
    pageSize: string | number
    type?: string
    status?: string
}) => http.get<PcListUserDetail>('/detail/pcListUserDetail', { params })




export const listDetailByOrderId = (params: {
    coinName: string
    unitName: string
    orderId: string
}) => http.get<ListDetailByOrderIdItem[]>('/detail/listDetailByOrderId', { params })